package com.usermanage.service.impl;

import com.usermanage.bean.Admin;
import com.usermanage.dao.AdminDao;
import com.usermanage.dao.impl.AdminDaoImol;
import com.usermanage.service.AdminService;

/**
 * 用户信息业务逻辑访问实现类
 * @author 陆贝伊
 *
 */
public class AdminServiceImpl implements AdminService{
	//创建数据库访问对象
	AdminDao ad=new AdminDaoImol();
	/**
	 * 查找用户信息
	 * @param a
	 * @return
	 */
	@Override
	public Admin queryAdminByAccount(Admin a) {
		Admin admin=ad.queryAdminByAccount(a);
		return admin;
	}
	/**
	 * 查重复
	 */
	@Override
	public String queryRepeatByAccount(String account) {
		boolean flag=false;
		Integer res=ad.queryRepeatByAccount(account);
		
		if (res>0) {
			flag=true;
		}
		return "{\"flag\":"+flag+"}";
	}
	/**
	 * 注册用户
	 * @param a
	 * @return
	 */
	@Override
	public int addAdmin(Admin a) {
		int res=ad.addAdmin(a);
		return res;
		
	}

}
